import { Form } from "antd";
import React from "react";
import { showValueType } from "./showValuesType";

const GetFieldsList = ({ form, fields }) => {


    return (
        fields.map((item, index) => <Form.Item
            name={item.name}
            label={item.label}
            key={index}
            rules={[
                {
                    required: item.required || false,
                    message: item.requiredMessage || '必填项',
                },
            ]}
        >

            {
                showValueType({
                    form: form,
                    TYPE: item.TYPE,
                    showSearch: item.showSearch,
                    url: item.url,
                    inputProps: item.inputProps,
                })
            }
        </Form.Item>)
    )
}

export default GetFieldsList